Repository navigation
net-gateway: tag TLS handshake failures with the peer's alert - #708
Merged
Merged
Conversation
gateway.tls.handshake carried an `alert` tag that was always `none`, so a guest rejecting the interception chain was indistinguishable from a guest that disconnected or reset mid-handshake: both were `reason:io`. Read the fatal alert rustls reports as `Error::AlertReceived` out of the tokio-rustls I/O error and tag it with its IANA TLS Alerts registry name (`unknown_ca`, `bad_certificate`, ...), keyed by wire value. Codepoints the registry does not assign are tagged with their decimal value. The same name now fills the `tls_alert` log field on handshake and established-connection failures. `reason` is unchanged.
Report the received alert as its numeric wire value (RFC 8446 section 6) on the metric tag and log field instead of a registry name.
kumarpallav-pplx
self-requested a review
October 20, 2026 17:34
kumarpallav-pplx
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
gateway.tls.handshakehas analerttag, butTlsFailure::newalways set it tononeand nothing ever filled it in. A guest that rejects the interception chain (sendsunknown_ca/bad_certificate) was recorded exactly like a guest that disconnects or resets mid-handshake:outcome:error, reason:io, alert:none.Change
io::Errorwrappingrustls::Error::AlertReceived(desc).alert:48(unknown_ca),alert:42(bad_certificate) oralert:46(certificate_unknown). The value fits in one byte, so the tag is bounded.nonestill means the peer sent no alert.tls_alertlog field ontls_handshake_error,gateway_boundary_failureandtls_connection_errorcarries the same number.reasonand every other tag are unchanged.alert_classfield.The tag reports alerts the peer sent. Alerts the gateway itself sends (for example when origin certificate verification fails) aren't surfaced by rustls in a general form, so they're out of scope here.
Validation
cargo fmt --all -- --checkpasses.cargo clippy -p pplx-space-net-gateway -p pplx-space-metrics --all-targets -- -D warningspasses.Rollout note
This doesn't add a new metric or tag key; the
alerttag just gets new values. If a deployment allowlists tags forgateway.tls.handshake,alertmust be on that allowlist.